package com.example.mapper;

import com.example.entity.DTO.TeacherDetailDTO;
import com.example.entity.Teacher;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 管理员Mapper
 */

public interface TeacherMapper {
    /**
     * 根据用户名查询教师
     * @param username
     * @return
     */
    @Select("select * from `teacher` where username = #{username}")
    Teacher selectByUsername(String username);


    /**
     * 根据用户名和学院名称查询教师详细信息
     * @param teacherName
     * @param deptName
     * @return
     */
    List<TeacherDetailDTO> selectAllTeacherByNameAndDeptName(String teacherName, String deptName);

    /**
     * 添加教师
     * @param teacher
     */
    void insert(Teacher teacher);

    /**
     * 根据id查询教师
     * @param id
     * @return
     */
    @Select("select * from `teacher` where id = #{id}")
    Teacher selectById(Integer id);

    /**
     * 更新教师信息
     * @param teacher
     */
    void updateById(Teacher teacher);

    /**
     * 删除教师
     * @param id
     */
    @Delete("delete from `teacher` where id = #{id}")
    void deleteById(Integer id);
}
